Merged
Conversation
Contributor
BenBaryoPX
commented
May 15, 2025
- Improve documentation
- typeMap now returns an empty array if type wasn't found in tree
- Add tests for edge cases
There was a problem hiding this comment.
Pull Request Overview
This PR improves documentation, augments test coverage for Arborist edge cases, and refines AST processing logic.
- Adds detailed tests for Arborist to validate node replacements and deletions.
- Enhances error handling and type mapping in AST extraction with a Proxy-based fallback.
- Updates JSDoc definitions and README usage examples to reflect new and improved features.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/arborist.test.js | Introduces additional edge-case tests to verify Arborist functionality. |
| src/types.js | Updates JSDoc type definitions for AST nodes and scopes for improved clarity. |
| src/flast.js | Improves error handling and type mapping using a Proxy, and adds a helper to build scope maps. |
| src/arborist.js | Refines Arborist’s change application process with enhanced comment merging and structure. |
| README.md | Updates documentation, usage examples, and installation instructions to align with new features. |
There was a problem hiding this comment.
Pull Request Overview
This PR enhances documentation, improves AST lookup behavior, and adds tests for edge cases.
- Corrected option typo (
alernateSourceTypeOnFailure→alternateSourceTypeOnFailure) and refactored parsing retry logic - Made
typeMapreturn an empty array for missing node types via a Proxy and added related helper (buildScopeVarMaps) - Expanded tests with multiple Arborist edge-case scenarios
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/functionality.test.js | Fixed typo in option name |
| tests/arborist.test.js | Added edge-case tests for comment preservation, deletions, and multiple changes |
| src/types.js | Streamlined and reorganized JSDoc for ASTNode and ASTScope |
| src/flast.js | Renamed option, added retry parsing block, Proxy fallback for typeMap, and buildScopeVarMaps |
| src/arborist.js | Introduced mergeComments, refactored deletion/replacement loops, and improved comment merging |
| README.md | Overhauled documentation, usage examples, and project info |
Comments suppressed due to low confidence (1)
tests/arborist.test.js:242
- No test validates that the new
typeMapProxy returns an empty array for unknown types. Consider adding a test case, e.g.,assert.deepEqual(ast[0].typeMap.NonexistentType, []);.
});
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.